package com.kt.controller;

import com.alibaba.fastjson.JSON;
import com.kt.domain.Order;
import com.kt.service.imp.OrderServiceImp;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/orders.do")
public class OrdersServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setCharacterEncoding("utf-8");
        OrderServiceImp orderServiceImp = new OrderServiceImp();
        List<Order> list = orderServiceImp.findByUid(req.getParameter("uid"));
        resp.getWriter().write(JSON.toJSONString(list));
    }


}
